Skip to content

fix(agc): transition resident attachment subresources - #6934

Merged
adriadam10 merged 1 commit into
boykopovar:mainfrom
JJenkx:fix/immediate-resident-subresources
Oct 19, 2026
Merged

adriadam10 merged 1 commit into
boykopovar:mainfrom
JJenkx:fix/immediate-resident-subresources

Conversation

@JJenkx

@JJenkx JJenkx commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

What

Immediate rendering to a resident mip or array-layer view transitions mip 0/layer 0 instead of the attachment subresource. APS5_SYNC_DRAWS=1 and target dumping can therefore issue VUID-vkCmdBeginRendering-pRenderingInfo-09592: the rendered subresource remains GENERAL while the attachment declares COLOR_ATTACHMENT_OPTIMAL.

Pass the selected mip and array-layer range to both immediate resident-image barriers. A 3D image still uses its single Vulkan array layer; its selected depth slices belong to that mip. Transient-image callers keep their existing default range. Only Draw.cpp changes, four lines replaced.

Tested

Current-main-only head 1b70ce290f on ea4cc112a0. Arch Linux 7.2.9-arch1-1, GCC 16.2.1 Release, Ryzen 9 7950X; RX 6650 XT / RADV Mesa 26.2.4-arch1.1 and lavapipe Mesa 26.2.4 / LLVM 23.1.1. Khronos validation layer 1.4.363, standard core checks; no explicit synchronization/GPU-assisted validation. Vulkan required, shader disk cache disabled, APS5_SYNC_DRAWS=1.

  • Full libs and the three existing execution test binaries build. agc_driver_array_layer_target, agc_driver_packed_mip_tail_target, agc_driver_layered_volume_draw: 3/3 pass on RADV and 3/3 on lavapipe, zero skips and zero validation errors/VUIDs. The volume case verifies that array-layer selection is not confused with 3D depth slices; its mesh subcase validates shaders only.
  • Production-only negative: replace only Draw.cpp with exact current-main source, keep the fixtures unchanged and rebuild. All three pixel tests still pass, but the array-target fixture reports two 09592 validation errors per driver, both on array layer 1 remaining in GENERAL. Restore/rebuild the fix: 3/3 pass with zero errors on both drivers again. The functional tests alone do not detect the API error; the validation logs do.
  • Native Override 2 PPSA01907 01.007.000 on integration c01f24339a1b (main b260d8d792 plus fix(agc): allow chunked imports as vertex and index buffers #6913/fix(agc): restrict sampled storage texture view usage #862/fix(agc): include the host stage in the CMASK clear's host-access barriers #6781 and diagnostic readbacks): the preceding target-dump run reports ten capped instances of the same VUID on mip 1. With this fix, the repeated target-dump run exits 0 after 97.64 s with zero validation errors/VUIDs and restored settings. This integration is not isolated current-main title validation. Very dark 3D rendering remains unchanged; no visual or FPS improvement is claimed. Bring-up and exact source.
  • External composition evidence from @Amoenus: feat(agc): back extra guest mip levels with storage images #7085 retains this exact 1b70ce290f3a2ef4d751c1f228540a589d3c1ff9 commit and declares it as a prerequisite. Their composition b605c6887 passes extra-mip, image-level, array-target and packed-tail fixtures 3/3 on RTX 5080 / driver 32.0.16.1062 and Radeon Graphics / driver 32.0.21036.18, Windows 11 Enterprise 26200, with Vulkan required, shader cache disabled, APS5_SYNC_DRAWS=1 and Khronos core 1.4.363: zero validation errors/warnings for those four groups. They also report Linux Mesa 25.2.8 llvmpipe 3/3 passes without explicitly enabled core validation. The layered-volume fixture passes 3/3 but emits ten WARNING-VkImageSubresourceRange-layerCount-compatibility warnings per physical run, including transfer barriers; these are not attributed solely to this change. These are attributed composition results, not standalone tests of this unchanged PR head.
  • External Apple-port evidence from @jotitadev: Apple M2 Max, macOS 27.2, x86-64 under Rosetta, MoltenVK 1.4.2 and Khronos validation 1.4.363, shader cache disabled and APS5_SYNC_DRAWS=1. On macos-port at b7eb6b6b plus ImportWatched, they applied this PR with the layer-range arguments adapted to one layer because that port lacks ColorTarget::layers. The array-target fixture passes pixel checks on both trees, but two layer-1 layout errors (VUID-vkCmdDraw-None-09600) on the unchanged port become zero with the adapted change. Packed-tail has no layout errors on either tree, so this does not validate the mip fix. Both trees retain the same twelve unrelated multisample-storage image-creation errors (00968). Their broader suite reports 14/433 failures, including a cross-workgroup case reproduced 5/5 on the unchanged port. This is attributed adapted-port evidence, not a clean-main macOS run or zero-error full suite.
  • Conventions against origin/main and whitespace pass. Required overlap check finds no confirmed overlap; its 22 conflicted shared-file heads were inspected at this helper and the resident barrier calls, with no selected-subresource implementation found. This is a scoped review, not a claim those whole branches combine cleanly.

Sanitized report, negative/restored validation logs and patch, assets prefixed resident-subresource or subresource-isolated. No new fixture, driver dependency or diagnostic code is included here. Standalone Windows/NVIDIA/macOS and full hosted builds have not been run by us; the external composition coverage above does not replace them. Full platform jobs require maintainer dispatch.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Unblocks: PPSA01907 Override 2: Super Mech League (PPSA01907) #6933 (synchronous-path layout error only; dark rendering remains unresolved)
  • GPUs tested: AMD RX 6650 XT / RADV Mesa 26.2.4-arch1.1, Arch Linux 7.2.9; lavapipe Mesa 26.2.4 / LLVM 23.1.1 on the same host
  • AI-assisted: yes

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 1191 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 1368 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 1395 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 4072 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 5431 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 5441 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 5499 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 5609 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 5925 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6188 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6202 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6292 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6539 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6615 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6636 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6661 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6683 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6718 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6727 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6820 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6946 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 6947 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 7256 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 7642 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp
PR 7668 core/libs/prx/libSceAgcDriver/Graphics/src/Draw.cpp

@Amoenus

Amoenus commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Thanks for the resident-subresource correction. #7085 builds its extra guest-mip backing on your exact 1b70ce290f3a2ef4d751c1f228540a589d3c1ff9 commit, preserving authorship and declaring #6934 as a prerequisite. Our added Draw work maps the selected guest mip to its physical image/mip through your existing range-argument interface.

Composition b605c6887 passes the extra-mip, image-level, array-target and packed-tail fixtures 3/3 on RTX5080/driver32.0.16.1062 and Radeon Graphics/driver32.0.21036.18, Windows11 Enterprise26200, with APS5_SYNC_DRAWS=1, Vulkan required, shader cache disabled and Khronos core1.4.363: zero validation errors/warnings. The corresponding Linux Mesa25.2.8 llvmpipe runs pass3/3; its core layer was not explicitly enabled. These are composition results, not tests of your unchanged head.

One additional observation: agc_driver_layered_volume_draw passes3/3 on each device and has zero physical core errors, but each physical run logs ten WARNING-VkImageSubresourceRange-layerCount-compatibility warnings. The layer says 3D images with VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT and maintenance9 disabled currently interpret layerCount=1 as all depth slices; VK_REMAINING_ARRAY_LAYERS would keep that interpretation when maintenance9 is enabled. The count includes texture-transfer barriers as well as immediate-draw coverage, so it is not attributed solely to your patch. I retained the behavior and disclosed the warning in #7085 for a separately scoped follow-up.

AI-assisted: yes (Codex); author responsible.

@jotitadev

jotitadev commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Apple GPU / MoltenVK run with the Khronos validation layer, since macOS was not run.

Machine: Apple M2 Max, macOS 27.2, x86-64 build under Rosetta. Head 1b70ce2. Method: macos-port @ b7eb6b6 + ImportWatched + PR diff, not main. The port has no ColorTarget::layers, so both new range arguments use one layer (what the port renders); otherwise the four Draw.cpp lines are the same. Driver: MoltenVK 1.4.2 (Vulkan SDK 1.4.363), VK_LAYER_KHRONOS_validation 1.4.363, APS5_SYNC_DRAWS=1, ANYPS5_NO_SHADER_CACHE=1.

Tree agc_driver_array_layer_target agc_driver_packed_mip_tail_target
port, Draw.cpp unchanged passes, 2 layout errors passes, no layout errors
port + this PR passes, 0 layout errors passes, no layout errors
  • On the port the layer reports the problem as VUID-vkCmdDraw-None-09600 at vkQueueSubmit, not as 09592, but it is the same subresource: arrayLayer = 1 expected in COLOR_ATTACHMENT_OPTIMAL while it is still GENERAL, and then the reverse on the way back. Both go away with the PR.
  • The pixel checks pass on both trees, as in your RADV/lavapipe run. So on Apple too, only the validation log shows the error.
  • The packed mip tail fixture has no layout error on the port even without the fix, so this run doesn't exercise the mip half of the change.
  • Both trees also show the same 12 VUID-VkImageCreateInfo-usage-00968 errors: a 4-sample image created with storage usage while shaderStorageImageMultisample is off (MoltenVK doesn't expose it). They are unrelated to this PR.

Full ^agc suite with the PR (SDK driver, -j1 --timeout 30, flip/display/lds_atomics64 excluded): 14 failures out of 433. These are the 13 known port-baseline failures plus agc_driver_cross_workgroup_flag, which also fails on the unchanged port on this machine today (intermittently, in streaks), so it isn't caused by this PR.

GPUs tested: Apple M2 Max (MoltenVK 1.4.2)

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

@github-actions github-actions Bot added the unblocks title Names a title ID on the Unblocks line label Oct 18, 2026
@adriadam10 adriadam10 self-assigned this Oct 19, 2026
@adriadam10
adriadam10 merged commit e004d03 into boykopovar:main Oct 19, 2026
11 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the diff: imageBarrier takes a subresource range (default unchanged for the transient callers) and both resident-image barriers in Draw now use binding.color.mip / arraySlice / layers, the same arguments AttachmentView is created with at line 2214; 3D images keep their single array layer. The 09592 negative/restored validation logs and the Windows (@Amoenus) and MoltenVK (@jotitadev) runs cover what the pixel fixtures can't; merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* unblocks title Names a title ID on the Unblocks line

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants